/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.juani.test.model.impl;

import com.juani.test.model.Client;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import java.io.Serializable;

import java.util.Date;

/**
 * The cache model class for representing Client in entity cache.
 *
 * @author Juan Martin Ruiz
 * @see Client
 * @generated
 */
public class ClientCacheModel implements CacheModel<Client>, Serializable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(25);

		sb.append("{clientId=");
		sb.append(clientId);
		sb.append(", companyId=");
		sb.append(companyId);
		sb.append(", userId=");
		sb.append(userId);
		sb.append(", userName=");
		sb.append(userName);
		sb.append(", createDate=");
		sb.append(createDate);
		sb.append(", modifiedDate=");
		sb.append(modifiedDate);
		sb.append(", firstName=");
		sb.append(firstName);
		sb.append(", lastName=");
		sb.append(lastName);
		sb.append(", address=");
		sb.append(address);
		sb.append(", email=");
		sb.append(email);
		sb.append(", phone=");
		sb.append(phone);
		sb.append(", movil=");
		sb.append(movil);
		sb.append("}");

		return sb.toString();
	}

	public Client toEntityModel() {
		ClientImpl clientImpl = new ClientImpl();

		clientImpl.setClientId(clientId);
		clientImpl.setCompanyId(companyId);
		clientImpl.setUserId(userId);

		if (userName == null) {
			clientImpl.setUserName(StringPool.BLANK);
		}
		else {
			clientImpl.setUserName(userName);
		}

		if (createDate == Long.MIN_VALUE) {
			clientImpl.setCreateDate(null);
		}
		else {
			clientImpl.setCreateDate(new Date(createDate));
		}

		if (modifiedDate == Long.MIN_VALUE) {
			clientImpl.setModifiedDate(null);
		}
		else {
			clientImpl.setModifiedDate(new Date(modifiedDate));
		}

		if (firstName == null) {
			clientImpl.setFirstName(StringPool.BLANK);
		}
		else {
			clientImpl.setFirstName(firstName);
		}

		if (lastName == null) {
			clientImpl.setLastName(StringPool.BLANK);
		}
		else {
			clientImpl.setLastName(lastName);
		}

		if (address == null) {
			clientImpl.setAddress(StringPool.BLANK);
		}
		else {
			clientImpl.setAddress(address);
		}

		if (email == null) {
			clientImpl.setEmail(StringPool.BLANK);
		}
		else {
			clientImpl.setEmail(email);
		}

		if (phone == null) {
			clientImpl.setPhone(StringPool.BLANK);
		}
		else {
			clientImpl.setPhone(phone);
		}

		if (movil == null) {
			clientImpl.setMovil(StringPool.BLANK);
		}
		else {
			clientImpl.setMovil(movil);
		}

		clientImpl.resetOriginalValues();

		return clientImpl;
	}

	public long clientId;
	public long companyId;
	public long userId;
	public String userName;
	public long createDate;
	public long modifiedDate;
	public String firstName;
	public String lastName;
	public String address;
	public String email;
	public String phone;
	public String movil;
}